<?php
session_start();

$_SESSION['kname'] = isset ($_SESSION['kname']) ? $_SESSION['kname'] : 0;
$_SESSION['kvorname'] = isset ($_SESSION['kvorname']) ? $_SESSION['kvorname'] : 0;

if (isset ($_GET['sstat']))
{
	echo "Name: {$_SESSION['kname']} Vorname: {$_SESSION['kvorname']}";
}
else 
{ ?>
	<form action="a05_name_vorname_B.php" method="get">
		Name <input type="text" name="iname" />
		Vorname <input type="text" name="ivorname" />
		<input type="submit" name="sname" value="name" />
		<input type="submit" name="svorname" value="vorname" />
		<input type="submit" name="sstat" value="stat" />
	</form>
	<?php
	if (isset ($_GET['sname']))
	{
// 		echo $_GET['iname'], ' + ', $_GET['ivorname'];
		echo htmlentities("{$_GET['iname']} + {$_GET['ivorname']}", ENT_QUOTES, 'UTF-8');
		$_SESSION['kname']++;
	} 
	elseif (isset ($_GET['svorname']))
	{
		echo $_GET['ivorname'];
		$_SESSION['kvorname']++;	
	}
}
?>